<template>
  <div class="history-container">
    <div class="goodslist">
      <Goods v-for="item in goodsList" :key="item.id" :goods="item" @click="clickhandle" />
    </div>
  </div>
</template>

<script>
import { reqHistory } from '@/api/user'
import Goods from '@/components/Goods'
export default {
  data() {
    return {
      goodsList: [],
      pageParams: {
        page: 1,
        pagesize: 10,
      },
    }
  },
  methods: {
    clickhandle(goods) {
      this.$router.push('/goodsdetail/' + goods.goods_id)
    },
    async getHistory() {
      let goodsList = await reqHistory(this.pageParams)
      this.goodsList = goodsList
    },
  },
  mounted() {
    this.getHistory()
  },
  components: {
    Goods,
  },
}
</script>

<style lang="scss" scoped>
.history-container {
  .goodslist {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 2px;
    background-color: #edebeb;
  }
}
</style>
